package com.zsrt.java.day20161223.zsh.demo06;

import java.util.Scanner;
import org.junit.Test;

public class demo61 {
	@Test
	public void calculatorswitch(){
		
		Scanner input=new Scanner(System.in);
		System.out.println("请输入第一个数字：");
		int first=input.nextInt();
		
		System.out.println("请在计算符号（+、-、*、/、%）中选择一个输入：");
		String sign=input.next();
		
		System.out.println("请输入第二个数字：");
		int second=input.nextInt();
		
		input.close();
		
		switch(sign){
		case "+":System.out.println(first+" + "+second+" = "+(first+second));break;
		case "-":System.out.println(first+" - "+second+" = "+(first-second));break;
		case "*":System.out.println(first+" * "+second+" = "+(first*second));break;
		case "/":System.out.println(first+" / "+second+" = "+(first/second));break;
		case "%":System.out.println(first+" % "+second+" = "+(first%second));break;
		}
	}
	

}
